﻿'use strict';
(function () {
    // 注意JS的绑定顺序，第一组绑定的文件可以用angular.module('MyControllers', []);，后续的文件只能用angular.module('MyControllers')
    var service = angular.module('MyServices');

    service.factory('examRoomService', ['$http', function (http) {
        var methods = {
            getList: function (planId) {
                return http.post('/ExamRoom/GetList', { planId: planId });
            }
        };
        return methods;
    }]);

    service.factory('setingRoomService', ['$http', function (http) {
        var methods = {
            getComputer: function (roomId) {
                return http.post('/ExamRoom/GetComputer', { roomId: roomId });
            },
            addone: function (roomId, ip, seatNo) {
                return http.post('/ExamRoom/AddOne', { roomId: roomId, ip: ip, seatNo: seatNo });
            },
            addMore: function (roomId, startIp, endIp, seatNo, order) {
                return http.post('/ExamRoom/AddMore', { roomId: roomId, startIp: startIp, endIp: endIp, seatNo: seatNo, order: order });
            },
            setIp: function (seatNo, ip) {
                return http.post('/ExamRoom/SetIp', { seatNo: seatNo, ip: ip });
            },
            updateByComputerIp: function (ip, seatNo) {
                return http.post('/ExamRoom/SetSeat', { ip: ip, seatNo: seatNo });
            },
            removeComputer: function (list) {
                return http.post('/ExamRoom/RemoveComputer', { list: list });
            }
        };

        return methods;
    }]);
})();